package com.qdlc.p2p.dal.dao.impl;

import java.util.List;

import javax.persistence.Query;

import org.springframework.stereotype.Repository;

import com.qdlc.p2p.dal.common.dao.jpa.BaseDaoImpl;
import com.qdlc.p2p.dal.dao.AdditionalFlowUploadDao;
import com.qdlc.p2p.dal.dto.AdditionalFlowUpload;
/**
 * 
 * 流转理财 图片上传 dao实现
 * @author zlhx
 * @version 2.0
 * @date 2015年8月6日 下午3:06:00
 */
@Repository("additionalFlowUploadDao")
public class AdditionalFlowUploadDaoImpl extends BaseDaoImpl<AdditionalFlowUpload> implements AdditionalFlowUploadDao {

	@SuppressWarnings("unchecked")
	@Override
	public List<AdditionalFlowUpload> findByFlowProjectId(long id) {
		Query query = em.createQuery("from AdditionalFlowUpload where flowProject.id=?")
				.setParameter(1, id);
		return query.getResultList();
	}

	@SuppressWarnings("unchecked")
	@Override
	public List<AdditionalFlowUpload> findByTypeAndFlowId(long flowId, int type) {
		Query query = em.createQuery("from AdditionalFlowUpload where flowProject.id=? and type = ?2")
				.setParameter(1, flowId)
				.setParameter(2, type);
		return query.getResultList();
	}


}
